#include<stdio.h>
int main(){
	int mana = 0,dis = 0,time = 0,len = 0,tmp = 0,t = 0;
	FILE *fin  = fopen ("escape.in", "r");
	FILE *fout = fopen ("escape.out", "w");
	fscanf(fin,"%d %d %d",&mana,&dis,&time);
	t = time;
	while(time && (len < dis)){
		if(mana >= 10){
			len += 60;
			mana -= 10;
		}else{
			tmp = dis - len;
			if((mana >=2 && time >= 3 && tmp >= 51) || (time >= 7 && tmp >= 119) || (mana >= 6  && time >= 2 && tmp >= 34)){
				mana += 4;
			}else{
				len += 17;
			}
		}
		--time;
	}
	if(len >= dis){
		fprintf(fout,"%d",t - time);
	}else{
		fprintf(fout,"%d",len);
	}
	fclose(fin);
	fclose(fout);
	return 0;
}
